import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
import Components from 'unplugin-vue-components/vite';
import { VantResolver } from 'unplugin-vue-components/resolvers';

const url = "http://103.181.234.114:8090/k3cloud"

let TimeStamp = new Date()  // 时间戳
export default defineConfig({
	base:'',
	plugins: [
		uni(),
		Components({
			resolvers: [VantResolver()]
		})
	],
	server: {
		port: 9001,
		header: {
			'Access-Control-Allow-Origin': '*'
		},
		proxy: {
			"/kd": {
				target: url,
				changeOrigin: true,
				rewrite: (path) => path.replace(/^\/kd/, "")
			}
		}
	},
	configureWebpack: {
	    output: { //重构文件名
	      filename: `[name].${TimeStamp}.js`, // index文件重命名为带有版本号+时间戳的格式
	      chunkFilename: `[name].${TimeStamp}.js` // static/js/pages-home-index.-V1-754654657.js  
	    },
	  }
})